<if condition="$itemList neq null">
	<volist name="itemList" id="vo">
	<div class="layui-input-inline">
		<select name="{$vo.code}_id" id="{$vo.code}_id" lay-filter="{$vo.code}_id" lay-search="">
			<option value="">【请选择{$vo.tname}】</option>
			{$vo['list']|make_option=$vo['selected'],name,id}
		</select>
	</div>
	</volist>
</if>

<script type="text/javascript">
layui.use(['form'],function(){

	//声明变量
	var layer = layui.layer
	,form = layui.form
	,$ = layui.$;

	//选择站点
	form.on('select(item_id)',function(data){
		var id = data.value;
		console.log("站点ID:"+id);
		var select = data.othis;
		if (select[0]) {
			if (id > 0) {
				$.post(mUrl+"/ItemCate/getChilds", { 'item_id':id }, function(data){
					if (data.success) {
						var str = "";
						$.each(data.data, function(i,item){
							str += "<option value=\"" + item.id + "\" >" + item.name + "</option>";
						});
						$("#p_cate_id").html('<option value="">【请选择一级栏目】</option>' + str);
						$("#cate_id").html('<option value="">【请选择二级栏目】</option>');
						form.render('select');
					}else{
						$("#p_cate_id").html('');
						$("#cate_id").html('');
						form.render('select');
						layer.msg(data.msg,{ icon: 5 });
						return false;
					}
				}, 'json');
			} else {
				
			}
		}
	});
	
	//选择一级栏目
	form.on('select(p_cate_id)',function(data){
		var id = data.value;
		console.log("一级栏目ID:"+id);
		var select = data.othis;
		if (select[0]) {
			if (id > 0) {
				$.post(mUrl+"/ItemCate/getChilds", { 'pid':id }, function(data){
					if (data.success) {
						var str = "";
						$.each(data.data, function(i,item){
							str += "<option value=\"" + item.id + "\" >" + item.name + "</option>";
						});
						$("#cate_id").html('<option value="">【请选择二级栏目】</option>' + str);
						form.render('select');
					}else{
						$("#cate_id").html('');
						form.render('select');
						return false;
					}
				}, 'json');
			} else {
				layer.msg(data.msg,{ icon: 5 });
				return false;
			}
		}
	});
	
	//选择二级栏目
	form.on("select(cate_id)",function(data){
		var id = data.value;
		console.log("二级栏目ID:"+id);
	});
	
});
</script>